import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
import { AccountRoles } from './accountRoles';

@Define.Table({ TableName: "roles" })
export class Roles extends EntityObjectType<Roles>{
    @Define.PrimaryKey()
    id: string;

    @Define.Column({ DataType: Define.DataType.VARCHAR, NotAllowNULL: true })
    name: string;

    @Define.Column({
        DataType: Define.DataType.BOOL,
        DefaultValue: false
    })
    isInneral: boolean;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;

    @Define.Mapping({
        Mapping: 'AccountRoles',
        MappingKey: 'roleId'
    })
    accountRoles: AccountRoles[];
}